<template>
  <!-- 报名成功页 -->
  <div class="c-bg-white">
    <div v-if="orderStatus == 0 || from == 1" class="c-pt40 c-bg-white" :class="fromType == 'activity' ? 'c-pb30' : 'c-pb60'">
      <template v-if="orderStatus == 0">
        <div class="c-flex-row c-flex-center">
          <img src="@/assets/i/wap/activity/commit_success.png" class="c-ww220 c-hh200" alt="">
        </div>
        <div class="c-textAlign-c c-fs32 c-fw-b">提交成功</div>
        <div class="c-textAlign-c c-fs20 c-fc-gray c-pt10">报名信息提交成功！请等待主办方审核</div>
      </template>
      <template v-else-if="from == 1">
        <div class="c-flex-row c-flex-center" v-if="orderStatus == 1">
          <img src="@/assets/i/wap/activity/apply_success.png" class="c-ww220 c-hh200" alt="">
        </div>
        <div class="c-flex-row c-flex-center" v-else>
          <img src="@/assets/i/wap/activity/noStock.png" class="c-ww220 c-hh200" alt="">
        </div>
        <div class="c-textAlign-c c-fs32 c-fw-b">{{orderStatus == -3 ? '库存不足,报名失败' : isShowAuth && !verifyStatus ? '请继续点击下方按钮实名认证' : '报名成功' }}</div>
        <div v-if="fromType == 'activity'" class="c-textAlign-c c-fs20 c-fc-gray c-pt10">您可以在我的-我的活动查看自己的报名信息</div>
        <div v-else class="c-textAlign-c c-fs20 c-fc-gray c-pt10">{{orderStatus == -3 ? '支付金额将在1-3个工作日内回退到您的账户' : '报名成功，请积极参与预约上课'}}</div>
      </template>
    </div>
    <!-- 特定公司、特定活动才有的实名认证入口（创客匠人5000人峰会） -->
    <div v-if="isShowAuth" class="c-bd-t12-f5 c-pv30">
      <div class="c-fs26 c-fw600 c-mb30 c-ph24">我报名的活动</div>
      <div class="c-ph24">
        <div class="c-fs24 c-fc-sblack c-lh40">为确保各位创始人IP能够高效、顺利地进入会场，请点击下方按钮，提前进行实名认证，感谢您的配合，祝愿您在本次峰会中收获满满！</div>
        <div class="c-mt20 c-flex-row c-flex-center c-hh64 c-br40 c-fs26 c-fc-white" :class="isActivityEnd ? 'c-bg-ccc' : 'theme-bg'" @click="goToAuthentication">{{isActivityEnd ? '活动已结束' : verifyStatus ? '已认证，点击按钮可修改认证信息' : '点我进行实名认证'}}</div>
      </div>
    </div>
    <!-- 活动报名成功 -->
    <div v-if="activityInfo && fromType == 'activity'" class="c-bd-t12-f5 c-pv30 c-fc-xblack">
      <div class="c-fs26 c-fw600 c-mb30 c-ph24">我报名的活动</div>
      <div class="c-ph24 c-flex-row c-mb30" @click="goActivityDetail">
        <div class="c-ww180 c-hh120 c-br16 c-text-hidden c-p">
          <CoverImg :coverSizeClass="'c-w100 c-h c-br16 c-text-hidden'" imgClass="c-br16" :coverUrl="$addXossFilter(activityInfo.poster, require('@/assets/activity_defult.png'))" />
        </div>
        <div class="c-pl20 c-w0 c-flex-grow1 c-maxh180 c-flex-column c-justify-sb">
          <div class="c-fs24 c-lh36 c-fc-xblack c-ww-bw c-ww-ba c-text-ellipsis2">{{activityInfo.name}}</div>
          <div class="c-fs20 c-fc-gray">时间：{{getEnrollTime(activityInfo.enrollStartAt)}}至{{getEnrollTime(activityInfo.enrollEndAt)}}</div>
        </div>
      </div>
      <div class="c-fs26 c-fw600 c-ph24 c-pt30 c-bd-t12-f5">我的票券：{{total}}</div>

      <div v-for="(item, index) in ticketList" :key="item.ticketNo" class="c-p c-pz1 c-text-hidden c-mh24 c-mt30" :class="item.status == -1 ? 'c-filter-gray100' : ''">
        <div class="c-br16 c-p c-pz1 c-fs24" :class="item.status == -1 ? 'c-fc-gray c-bd1-f6' : 'c-fc-sblack theme-bd1-50'">
          <div class="c-pa c-p-t0 c-p-l0 c-br-tl16 c-br-tr16 c-pz-1 c-w100 c-hh100 theme-bg-gradient18020 c-opacity40"></div>
          <div class="c-p c-pz10 c-pv26 c-ph24" :class="isShowGift(item) ? 'c-bd-dd1' : ''">
            <i v-if="isShowGift(item)" class="c-ww20 c-hh20 c-bg-white c-brp50 c-pa c-pz10 c-p-lm10 c-p-bm10" :class="item.status == -1 ? 'c-bd1-f6' : 'theme-bd1-50'"></i>
            <i v-if="isShowGift(item)" class="c-ww20 c-hh20 c-bg-white c-brp50 c-pa c-pz10 c-p-rm10 c-p-bm10" :class="item.status == -1 ? 'c-bd1-f6' : 'theme-bd1-50'"></i>
            <i v-if="item.status == 0" class="iconfont c-pa c-p-rm12 c-p-t0 theme-fc c-fs80">&#xe874;</i>
            <div v-else :class="getStatusClass(item)" class="c-fc-white c-hh32 c-ph12 c-br-tr16 c-br-bl12 c-fs20 c-pa c-p-r-2 c-p-t0 c-flex-row c-aligni-center">
              {{item.receiveUserId != 0 && item.receiveUserId != userId ? '已领取' : statusMap[item.status]}}
            </div>
            <div class="c-fs26 c-fw600" :class="item.status == -1 ? 'c-fc-gray' : 'c-fc-xblack'">{{item.ticketName}}</div>
            <div class="c-mt16">参加人：{{item.name}}</div>
            <div class="c-mt16">联系电话：{{item.mobile}}</div>
            <template v-if="item.fieldVal && item.fieldVal.length && item.isShowAll">
              <div v-for="(cItem,cIndex) in item.fieldVal" :key="cIndex" class="c-mt16">{{cItem.name}}：{{cItem.value}}</div>
            </template>
            <div v-if="item.status != -1 && item.status != 0" class="c-mt16">票号：{{item.ticketNo}}</div>
            <div v-if="item.fieldVal && item.fieldVal.length" @click.stop="clickChangeIsShow(index)" class="c-flex-row c-flex-center c-fs20 c-fc-gray c-mt16">
              <span>{{item.isShowAll ? '收起':'展开全部'}}</span>
              <i :class="item.isShowAll ? 'icon-shangfangxiangjian':'icon-xiafangxiang'" class="iconfont c-pl6 c-fs16 c-fc-gray"></i>
            </div>
          </div>
          <div v-if="isShowGift(item)" class="c-pv18 c-ph24">
            <div @click.stop="openGifts(item)" class="c-w100 c-boxSizing-b c-fs22 c-flex-row c-fc-xblack c-aligni-center">
              <div class="c-mr20 c-fc-xblack c-fw-b c-fs22">赠品</div>
              <div class="c-flex-grow1">
                <div class="c-fs22 c-flex-row c-aligni-center c-justify-sb">
                  <div class="c-br4 c-textAlign-c c-mr20 c-ph4 c-pv2 theme-bg-10 theme-fc c-fs16">礼包</div>
                  <div class="c-text-ellipsis1 c-fc-xblack">内含{{item.giftRelates && item.giftRelates.length}}个商品</div>
                  <div class="c-flex-grow1 c-flex-row c-aligni-center c-justify-end">
                    <div class="c-flex-row c-aligni-center theme-fc">
                      <span v-if="item.giftRelates[0] && item.giftRelates[0].userId == userId" class="c-fs22">{{item.giftRelatesStatus ? '查看' : '领取礼包'}}</span>
                      <span class="iconfont c-fs22">&#xe635;</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 预约成功 -->
    <template v-else>
      <div @click="clickActivityDetail" class="c-m-0auto c-ww480 c-br30 c-hh64 c-flex-row c-flex-center theme-bg-gradient c-fc-white c-fs26">预约上课</div>
      <div @click="goToMyReservationList" class="c-m-0auto c-ww480 c-br30 c-hh64 c-flex-row c-flex-center theme-bd1 theme-fc c-fs26 c-mt28 c-mb64">我的约课</div>
    </template>
    <div v-if="fromType == 'activity' && from != 1" class="c-ph24 c-pf c-p-b0 c-w100 c-maxw640 c-bd-t1 c-bg-white c-hh88 c-flex-row c-flex-center c-fs26">
      <div @click="clickMoreActivity" class="c-w100 c-br40 c-hh64 c-flex-row c-flex-center theme-bg c-fc-white c-fs26">查看更多活动</div>
    </div>
    <!-- 入群引导 -->
    <cj-popup v-model="showGuidePop" @closed="closeGuidePop" round :closeable="true" closeIconPosition="bottom-center" close-icon="icon-shanchu">
      <div class="c-ww500 c-p c-w100 c-fs24 c-fc-xblack">
        <div class="c-p c-pz10 c-flex-column c-flex-center c-fs24 c-bg-white c-br-tl16 c-br-tr16 c-pt40 c-pb20 c-ph22">
          <div class="c-textAlign-c">{{guideInfo.guideDesc}}</div>
          <div class="c-mt36 c-ww240 c-hh240 c-br c-mt50 c-p c-pz1 c-br8">
            <div class="iconfont c-fs32 theme-fc c-pa c-p-tm8 c-p-lm8 c-pz10 c-rotate180">&#xe865;</div>
            <div class="iconfont c-fs32 theme-fc c-pa c-p-tm8 c-p-rm8 c-pz10 c-rotate270">&#xe865;</div>
            <div class="iconfont c-fs32 theme-fc c-pa c-p-bm8 c-p-lm8 c-pz10 c-rotate90">&#xe865;</div>
            <div class="iconfont c-fs32 theme-fc c-pa c-p-bm8 c-p-rm8 c-pz10">&#xe865;</div>
            <img class="c-ww240 c-hh240 c-p c-pz1 c-br8" :src="$addXossFilter(guideInfo.guideQrcode, '')" alt="">
          </div>
          <div class="c-mt30 c-fw600 c-textAlign-c">{{guideInfo.guideTitle}}</div>
        </div>
        <div class="c-p c-pz1">
          <img src="https://ck-bkt-knowledge-payment.oss-cn-hangzhou.aliyuncs.com/admin/material/9_material_admin/image/assets/i/wap/activity/ticket_bottom_bg.png" class="c-w100 c-h-auto c-block c-mtm20">
          <div class="c-pa c-p-l0 c-p-b0 c-w100 c-h100 c-boxSizing-b c-flex-row c-fc-xblack c-flex-center c-pb24">
            <div class="c-ww300 c-hh52 c-br30 c-flex-row c-flex-center theme-bg-10 theme-fc c-fs22 c-fw600"><span class="iconfont c-fs28 c-fw400 c-mr8">&#xe875;</span>长按二维码识别</div>
          </div>
        </div>
      </div>
    </cj-popup>
    <!-- 赠送礼包 -->
    <gift-modal :tipText="giftTipText" :isShowBtn="isShowGiftBtn" :fromProdType="7" :hasBuy="true" :showGiftModal="showGifts" :fromCourseId="activityNo" :prodList="giftRelatesItem.giftRelates" @closeGift="showGifts = false"></gift-modal>
    <cj-confirm :isShow="isShowVerifyTip" :option="{title:'', message: '', titleCenter: true, showMasker: true, clickCloseModal: false, showCancelButton: false, cancelButtonText: '',confirmButtonText: '去认证'}" @onConfirm="goToAuthentication">
      <div class="c-p c-fc-xblack">
        <div class="c-textAlign-c c-fs28 c-fw600">实名认证</div>
        <div class="c-mt20 c-ph40 c-fs24">请继续点击下方按钮实名认证，认证成功后方可通过人脸识别进入会场</div>
        <span @click="closeVerifyTip" class="iconfont c-fs24 c-fc-sgray c-pa c-p-tm20 c-p-r20">&#xe773;</span>
      </div>
    </cj-confirm>
  </div>
</template>
<script>
import { utilJs } from "@/utils/common.js"
import giftModal from '@/components/templates/giftModal';
import CoverImg from '@/components/templates/common/coverImg.vue';
import CjConfirm from "@/plugin/cjConfirm/cjConfirm.vue";

let activityNo = '';
let isFromOrder = 'FAlSE';
let fromPath = '';
let pageIndex = 1;
export default {
  name: "ActivitySuccess",
  components: {
    giftModal,
    CoverImg,
    CjConfirm
  },
  data() {
    return {
      theme: localStorage.getItem("colorName") || 'mb5_default',
      from: 1, // 从哪里跳转过来
      guideInfo: "", //入群引导信息
      showGuidePop: false, //显示入群提示
      orderStatus: 1,
      enrollNum: '', //参与人数
      enrollInfo: [], //参与者信息
      defaultValue: 5, //前5条全部显示
      defaultStatus: false,
      activityInfo: null,
      isLoading: false,
      pageLimit: 10,
      total: 0,
      ticketList: [],
      dataStatus: 'NO_MORE_DATA',
      userId: '',
      statusMap: {
        "-2": "拼团中",
        "-1": "已作废",
        "0": "待审核", // 蓝色
        "1": "待签到", // 橘色
        "2": "待付款",
        "4": "已签到", // 绿色
        "5": "使用中",
      },
      giftRelatesItem: {}, // 单个票券
      showGifts: false, // 是否展示礼包弹窗
      hasGiftTip: false, // 是否需要提示含有未兑换的商城商品
      isShowGiftBtn: true, // 是否展示领取/查看按钮
      isShowVerifyTip: false, // 是否展示认证提示弹窗
    }
  },
  beforeRouteEnter(to, from, next) {
    fromPath = from.path;
    next();
  },
  created() {
    utilJs.appShare(this);
  },
  computed: {
    giftTipText() {
      // 礼包领取设置: giftDeliveryMethod 1报名成功后即可领取  2首次签到后可领取
      return `<p>赠品需${this.activityInfo && this.activityInfo.giftDeliveryMethod == 2 ? '首次签到' : '要等报名审核通过'}后，回到当前页面手动领取</p><p class="c-fc-red">注：礼包领取后，该票券就不能继续赠送给他人了</p>`;
    },
    isShowAuth() { // 是否展示实名认证入口，特定公司特定活动才有(isSummitActivity=true)
      const item = this.ticketList && this.ticketList[0] ? this.ticketList[0] : {}
      return this.fromType == 'activity' && (item.status == 1 || item.status == 4 || item.status == 5) && this.activityInfo && this.activityInfo.isSummitActivity
    },
    verifyStatus() { // 第一张票券是否已实名，（产品黄长发：指定活动已限制只能购买一张票，所以不用考虑多张票券的情况）
      const item = this.ticketList && this.ticketList[0] ? this.ticketList[0] : {}
      return !!item.verifyStatus
    },
    isActivityEnd() {
      const enrollEndAt = this.activityInfo.enrollEndAt || ''
      const endTime = new Date(enrollEndAt.replace(/-/g, '/')).getTime()
      const nowTime = new Date().getTime()
      return nowTime > endTime
    }
  },
  methods: {
    closeVerifyTip() {
      this.isShowVerifyTip = false;
      this.showShopGiftTip();
    },
    getStatusClass(item = {}) {
      if (item.status == 1 && (item.receiveUserId == 0 || item.receiveUserId == this.userId)) { // 待签到
        return 'c-bg-xmlred'
      } else if (item.status == 4) { // 已签到
        return 'c-bg-03BA50'
      } else if (item.status == -1) { // 已作废
        return 'c-bg-ccc'
      }
      return 'theme-bg'
    },
    goToAuthentication() {
      if (this.isActivityEnd) {
        return
      }
      const item = this.ticketList && this.ticketList[0] ? this.ticketList[0] : {}
      const summitVerifyUrl = item.summitVerifyUrl
      window.location.href = summitVerifyUrl
    },
    isShowGift(item) {
      // 有礼包 && (待审核 || 待签到 || 已签到 || 使用中)
      return item.giftRelates && item.giftRelates.length && (item.status == 0 || item.status == 1 || item.status == 4 || item.status == 5)
    },
    showShopGiftTip() {
      if (!this.showGuidePop && this.hasGiftTip) {
        let $this = this;
        this.$cjConfirm({
          title: '', //
          titleCenter: true, //标题是否居中
          message: '您有一个礼包可领取，是否前往领取',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: true, //是否显示取消按钮
          cancelButtonText: '取消', //取消按钮文本
          confirmButtonText: '去领取', //确认按钮文本
          onConfirm() {
            let giftPopArrTmp = localStorage.getItem('giftPopArr') ? JSON.parse(localStorage.getItem('giftPopArr')) : [];
            giftPopArrTmp.push(activityNo)
            localStorage.setItem('giftPopArr', JSON.stringify(giftPopArrTmp));
            $this.openGifts($this.giftRelatesItem);
          },
          onCancel() {
            let giftPopArrTmp = localStorage.getItem('giftPopArr') ? JSON.parse(localStorage.getItem('giftPopArr')) : [];
            giftPopArrTmp.push(activityNo)
            localStorage.setItem('giftPopArr', JSON.stringify(giftPopArrTmp));
          }
        })
      }
    },
    closeGuidePop() {
      this.showGuidePop = false;
      this.showShopGiftTip()
    },
    openGifts(item) {
      this.showGifts = true
      this.giftRelatesItem = item
      const giftRelates = item.giftRelates
      // 判断礼包所属权，不是自己的礼包，弹窗不展示领取/查看按钮
      // giftRelates[0].userId礼包所属人id，礼包只会有一个归属人，所以只需要判断礼包其中一个商品的userId
      this.isShowGiftBtn = giftRelates[0].userId == this.userId
    },
    goActivityDetail() {
      let query = {
        ActivityNo: activityNo,
      }
      if (this.fromType == 'reservation') {
        query.from = this.fromType
      }
      this.$routerGo(this, "push", {
        path: "/activity/activityDetail",
        query: query
      })
    },
    toTicketNum(status, receiveUserId) {
      //非已作废&&非未审核
      if (((status == 1 || status == 4) && (receiveUserId == 0 || receiveUserId == this.userId)) && !this.showShare && this.fromType != 'signin') {
        // 点击查看票券
        this.$routerGo(this, "push", {
          path: `/activity/ticketNum`,
          query: { activityId: activityNo, identCode: this.$route.query.identCode, from: 'activity' }
        });
      }
    },
    // 处理报名时间
    getEnrollTime(val) {
      if (!val) {
        return ''
      }
      return val.substr(5, 11)
    },
    getActicityInfo() {
      let url = `activities/getShareActivtiyInfo?activityId=${activityNo}`
      utilJs.getMethod(`${global.apiurl}${url}`, (res) => {
        this.getMyTicket();
        this.activityInfo = res;
      });
    },
    getMyTicket() {
      if (this.isLoading) {
        return
      }
      this.isLoading = true;
      // identCode报名标识（type=1 时传） type1：我的票券页面
      let url = `activities/getTicketByCode?activityId=${activityNo}&identCode=${this.identCode}&type=1&asId=0`
      utilJs.getMethod(`${global.apiurl}${url}&limit=${this.pageLimit}&page=${pageIndex}`, (res) => {
        this.isLoading = false;
        this.total = res.enrollList.total;
        this.hasGiftTip = false
        for (let item of res.enrollList.data) {
          item.isShowAll = false;
          item.fieldVal = this.resetFormData(item.fieldVal);
          // 票券所属人是本人 && 包含未领取的商品
          const index = item.giftRelates.findIndex(gItem => gItem.userId == this.userId && gItem.status != 1)
          item.giftRelatesStatus = index < 0 // 不包含则全部已领取，整体状态giftRelatesStatus为已领取
          // 转赠的票 || 作废的票， 都不会主动提示 礼包有商城商品
          const isNoTransfer = (item.receiveUserId == 0 || item.receiveUserId == this.userId) && item.status != -1
          // 是否包含未领取商品
          const sIndex = item.giftRelates.findIndex(gItem => gItem.status != 1)
          if (isNoTransfer && !this.hasGiftTip && sIndex > -1) {
            this.hasGiftTip = true
            this.giftRelatesItem = item
          }
        }
        this.ticketList = [...this.ticketList, ...res.enrollList.data];
        if (res.enrollList.next_page_url) {
          pageIndex++
        }
        this.dataStatus = res.enrollList.next_page_url ? 'HAS_MORE_DATA' : res.enrollList.data == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
        if (pageIndex > 1) { // 第一页才需要判断实名认证弹窗提示
          return
        }
        // 是否展示实名认证入口，特定公司特定活动才有(isSummitActivity=true)
        const item = this.ticketList && this.ticketList[0] ? this.ticketList[0] : {}
        const isShowAuth = this.fromType == 'activity' && (item.status == 1 || item.status == 4 || item.status == 5) && this.activityInfo && this.activityInfo.isSummitActivity
        const enrollEndAt = this.activityInfo.enrollEndAt || ''
        const endTime = new Date(enrollEndAt.replace(/-/g, '/')).getTime()
        const nowTime = new Date().getTime()
        const isActivityEnd = nowTime > endTime
        if (isShowAuth && !item.verifyStatus && !isActivityEnd) { // 需要认证 && 未认证 && 活动未结束
          this.isShowVerifyTip = true
        } else {
          this.showShopGiftTip()
        }
      });
    },
    resetFormData(data) {
      if (!data) {
        return [];
      }
      for (let item of data) {
        let options = item.options;
        let value = item.value
        //单选
        if (item.dataType == 5) {
          item.value = options[value];
        }
        //多选
        if (item.dataType == 6) {
          let arr = [];
          for (let i of value) {
            arr.push(options[i]);
          }
          item.value = arr.join(',');
        }
        if (item.dataType == 7 && value && value.name) {
          item.value = `${value.name.join(' ')} ${value.addressDetail}`;
        }
      }
      return data;
    },
    clickChangeIsShow(index) {
      this.ticketList[index].isShowAll = !this.ticketList[index].isShowAll;
    },
    windowScrollFunction: function () {
      utilJs.handleLoading(() => {
        if (this.dataStatus == 'HAS_MORE_DATA' && this.ticketList.length > 0) {
          this.getMyTicket();
        }
      });
    },
    // 获取引导入群信息
    getGuideInfo() {
      let $this = this;
      //type 1:详情页；2:报名成功
      utilJs.getMethod(`${global.apiurl}activities/getGuideInfo?activityId=${activityNo}&type=2`, (res) => {
        $this.guideInfo = res;
        if ($this.guideInfo != "") {
          $this.showGuidePop = true;
        }
      });
    },
    //点击跳到我的约课
    goToMyReservationList() {
      this.$routerGo(this, "push", { path: `/member/myReservation/reservationClassList` });
    },
    // 点击查看票券
    linkToTicketNum() {
      //库存不足时
      if (this.orderStatus == -3) {
        this.$routerGo(this, "replace", {
          path: `/activity/activityDetail?ActivityNo=${activityNo}&from=${this.fromType}`
        });
      } else {
        this.$routerGo(this, "replace", {
          path: `/activity/myTicket?activityId=${activityNo}&identCode=${this.identCode}&asId=${0}`
        });
      }
    },
    clickActivityDetail() {
      if (this.orderStatus == -3 && this.fromType == 'activity') {
        let toPath = `/activity/activityIndex`;
        this.$routerGo(this, "replace", { path: toPath })
      } else {
        if (isFromOrder == 'FALSE') {
          if (this.$route.query.isSubMch) {
            let toPath = `/activity/activityDetail?ActivityNo=${activityNo}&from=${this.fromType}`;
            this.$routerGo(this, "replace", { path: toPath })
          } else {
            this.$router.go(-1);
          }
        } else {
          let toPath = `/activity/activityDetail?ActivityNo=${activityNo}&from=${this.fromType}`;
          this.$routerGo(this, "replace", { path: toPath })
        }
      }
    },
    clickMoreActivity() {
      let toPath = `/activity/activityIndex`;
      this.$routerGo(this, "replace", { path: toPath })
    },
    show() {
      this.defaultStatus = !this.defaultStatus;
      if (this.defaultStatus) {
        this.defaultValue = this.enrollNum;
      } else {
        this.defaultValue = 5;
      }
    },
    //分享
    wechatShare: function () {
      utilJs.wechatConfig("", "", "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      utilJs.appShareTrue("", "", "", "");
    }
  },
  activated() {
    // 1 支付成功 2 提交成功
    this.enrollNum = '';
    this.enrollInfo = [];
    this.defaultValue = 5;
    this.defaultStatus = false;
    // collectPage 3 选填时就不需要跳转到关联表单页
    console.log('支付成功', fromPath, fromPath == '/homePage/course/coursePay' || fromPath == '/activity/activityEnroll', this.$route.query.hasFormSet == 1, this.$route.query.collectPage != 3, this.$route.query.collectPage)
    if ((fromPath == '/homePage/course/coursePay' || fromPath == '/activity/activityEnroll') && this.$route.query.hasFormSet == 1 && this.$route.query.collectPage != 3) {
      this.$routerGo(this, "push", { path: '/homePage/form', query: { relId: this.$route.query.activityNo, ckFrom: global.ckFrom.activity, isFromInvite: 0, relType: 7, type: 1 } });
      return;
    }
    this.fromType = this.$route.query.fromType || 'activity';
    this.from = this.$route.query.from || 2;
    activityNo = this.$route.query.activityNo || '';
    isFromOrder = this.$route.query.isFromOrder || 'FALSE';
    this.identCode = this.$route.query.identCode || '';
    if (this.fromType == 'activity') {
      utilJs.getMethod(`${global.apiurl}activities/checkEnrollStatus?activityId=${activityNo}&identCode=${this.identCode}`, res => {
        this.orderStatus = res.retCode;
        this.enrollNum = res.enrollNum;
        this.enrollInfo = res.enrollInfo;
      })
       this.getActicityInfo();
    }
    this.showGuidePop = false;
    this.guideInfo = "";
    this.ticketList = []
    this.userId = localStorage.getItem("userId");
    this.giftRelatesItem = {}; // 单个票券
    this.showGifts = false; // 是否展示礼包弹窗
    this.hasGiftTip = false; // 是否需要提示含有未领取商品
    this.isShowGiftBtn = true; // 是否展示领取/查看按钮
    this.isShowVerifyTip = false;
    const title = this.from == 1 ? '支付成功' : '提交成功';
    this.from == 1 && this.getGuideInfo();
    setDocumentTitle(title);
    this.wechatShare();
    window.addEventListener('scroll', this.windowScrollFunction);
  },
  deactivated() {
    window.removeEventListener('scroll', this.windowScrollFunction);
  }
}
</script>
<style scoped>
.study-box {
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.08);
}
.icon-study {
  position: absolute;
  top: -0.6rem;
  left: -0.3rem;
  width: 2.7rem;
  height: 1.3rem;
  z-index: 2;
}
.line90 {
  width: 2.5rem;
  height: 1px;
  background: #e5e5e5;
}
textarea {
  resize: none;
}
.fc-orange {
  color: #fa703d;
}
.fc-green {
  color: #21b142;
}
.fc-gray {
  color: #c3c7d3;
}
.close-icon {
  background: rgba(0, 0, 0, 0.1);
}
.bg-orange {
  background: rgba(250, 112, 61, 0.08);
}
.form-tip {
  color: #fa703d;
  background-color: #fef0eb;
}
/* 优惠券样式 */
.ticketItemInfo {
  border-radius: 0.4rem;
  border: 1px solid var(--mb7color);
}
.ticket-dot-left, .ticket-dot-right {
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--mb7color);
  position: absolute;
  background: #fff;
  z-index: 9;
}
.ticket-dot-left {
  bottom: -6px;
  left: -6px;
}
.ticket-dot-right {
  bottom: -6px;
  right: -6px;
}

</style>


